<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="h" uri="http://cn.gson.com/jsp/mytag" %>
<!DOCTYPE html >
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>主页</title>
<script type="text/javascript" src="static/easyui/jquery.min.js"></script>
<script type="text/javascript" src="static/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="static/easyui/locale/easyui-lang-zh_CN.js"></script>
<link id="easyuiTheme" rel="stylesheet" href="static/easyui/themes/ui-cupertino/easyui.css">
<link rel="stylesheet" href="static/easyui/themes/icon.css">
<script type="text/javascript" src="static/js/jquery.cookie.js"></script>
</head>
<body>
<style type="text/css">
/* /////////////////////////////////////////////// */
#body1{
		width:950px;
		background:#DBEDFA;
		 margin:0px auto;
		
		
	}
	#zuozhen{
		border:1px solid #19AA8D;
		width:950px;
		height:40px;
		text-align:center;
		line-height:40px;
		font-family:'楷体';
		font-size: 26px;
	}
	#swxw{
		border-left:1px solid #19AA8D;
		width:950px;
		height:25px;
		border-right:1px solid #19AA8D;
		
	}
	#sjry{
		width:100px;
		font-family:'楷体';
		font-size:20px;
		float:left;
		border-right:1px solid #19AA8D;
		height:25px;
		text-align: center;
	}
	
	#zuo{
		border-right:1px solid #19AA8D;
		height:25px;
		width:211px;
		float:left;
		text-align:center;
	}
	#zuo1{
		border-right:1px solid #19AA8D;
		height:25px;
		width:211px;
		float:left;
		text-align:center;
	}
	#zuo2{
		border:none;
		height:25px;
		width:211px;
		float:left;
		text-align:center;
		border-right:1px solid #19AA8D;
	}
	#zuo3{
		height:25px;
		width:211px;
		float:left;
		text-align:center;
	}
</style>
<script type="text/javascript"> 
$(function(){ 
	//退出登陆
	$("#logout").click(function(){
		$.post(
			"logout",
			function(){
				window.location.href="denglu";
			}
		);
	});
});


 //查询门诊早班医生包括全班
var docters=function(value,row,index){
	var did=row.departments_id;
	var zbys="";
	$.ajax({
		url:'mzYszb',
		type:'post',
		data:{
			"departments_id":did,
		},
		async:false,
		success:function(d){
			for (var i = 0; i < d.length; i++) {
				zbys+="<p>"+d[i]['user_name']+"</p>";
			}
		}
	});
	return zbys;
};
//查询门诊中班医生包括全班
var zhongbanyis=function(value,row,index){
	var did=row.departments_id;
	var hbys="";
	$.ajax({
		url:'mzYshb',
		type:'post',
		data:{
			"departments_id":did,
		},
		async:false,
		success:function(d){
			for (var i = 0; i < d.length; i++) {
				hbys+="<p>"+d[i]['user_name']+"</p>";
			}
		}
	});
	return hbys;
};
//查询门诊晚班医生
var wanbanyis=function(value,row,index){
	var did=row.departments_id;
	var wbys="";
	$.ajax({
		url:'mzYswb',
		type:'post',
		data:{
			"departments_id":did,
		},
		async:false,
		success:function(d){
			for (var i = 0; i < d.length; i++) {
				wbys+="<p>"+d[i]['user_name']+"</p>";
			}
		}
	});
	return wbys;
};
//查询门诊夜班医生
var yebanyis=function(value,row,index){
	var did=row.departments_id;
	var ybys="";
	$.ajax({
		url:'mzYsyb',
		type:'post',
		data:{
			"departments_id":did,
		},
		async:false,
		success:function(d){
			for (var i = 0; i < d.length; i++) {
				ybys+="<p>"+d[i]['user_name']+"</p>";
			}
		}
	});
	return ybys;
};


//查询门诊早班护士包括全班
var zaobanhus=function(value,row,index){
	var did=row.departments_id;
	var zbhs="";
	$.ajax({
		url:'mzHszb',
		type:'post',
		data:{
			"departments_id":did,
		},
		async:false,
		success:function(d){
			for (var i = 0; i < d.length; i++) {
				zbhs+="<p>"+d[i]['user_name']+"</p>";
			}
		}
	});
	return zbhs;
};
//查询门诊中班护士包括全班
var zhongbanhus=function(value,row,index){
	var did=row.departments_id;
	var hbhs="";
	$.ajax({
		url:'mzHshb',
		type:'post',
		data:{
			"departments_id":did,
		},
		async:false,
		success:function(d){
			for (var i = 0; i < d.length; i++) {
				hbhs+="<p>"+d[i]['user_name']+"</p>";
			}
		}
	});
	return hbhs;
};
//查询门诊晚班护士
var wanbanhus=function(value,row,index){
	var did=row.departments_id;
	var wbhs="";
	$.ajax({
		url:'mzHswb',
		type:'post',
		data:{
			"departments_id":did,
		},
		async:false,
		success:function(d){
			for (var i = 0; i < d.length; i++) {
				wbhs+="<p>"+d[i]['user_name']+"</p>";
			}
		}
	});
	return wbhs;
};
//查询门诊夜班护士
var yebanhus=function(value,row,index){
	var did=row.departments_id;
	var ybhs="";
	$.ajax({
		url:'mzHsyb',
		type:'post',
		data:{
			"departments_id":did,
		},
		async:false,
		success:function(d){
			for (var i = 0; i < d.length; i++) {
				ybhs+="<p>"+d[i]['user_name']+"</p>";
			}
		}
	});
	return ybhs;
}; 


 $(function(){
		$("#grzx").click(function(){
			var a=${user.userId};
				$.ajax({
					url:'yhxg',
					type:'post',
					data:{
						yhid:a,
					},
					success:function(d){
						if(d==""){
							alert("失败了");
						}else{
							$("#qxa1").window("open");
							$("#yhid1").textbox("setValue",d[0]["yhid"]);
							$("#yhname1").textbox("setValue",d[0]["yhname"]);
							var aa=d[0]["zt"];
							if(aa==0){
								$("#zt1").textbox("setValue","离职");
							}else{
								$("#zt1").textbox("setValue","在职");
							}
							
							$("#phone1").textbox("setValue",d[0]["phone"]);
							$("#xzksa1").textbox("setValue",d[0]["yhks"]);
							 
							console.log(d);
						}
					}
				});
			
		});
	 
		$("#xgxx").click(function(){
			var pwd=$("#pwd1").textbox("getValue");
			var pwds=$("#pwds1").textbox("getValue");
			var yhid=${user.userId};
			$.ajax({
				url:'xgmm',
				type:'post',
				data:{
					yhid:yhid,
					pwd:pwd,
					pwds:pwds,
				},
				success:function(d){
					$("#qxa1").form("clear");
					$("#qxa1").window("close");
				}
			});
		});
	$("#panbbban").datagrid({
		url:'findks',
		columns:[[
			{field:'departments_id',title:'科室id',hidden:true,width:100,align:'center'},
			{field:'departments_lb',title:'科室类别',hidden:true,width:100,align:'center'},
			{field:'departments_name',title:'科室/人员',width:101,align:'center',
				formatter:function(value,row,index){
					if(row.departments_lb==2){
						return value+"--住院";
					} 
						return  value+"--门诊";
				}
			},	
			{field:'a',title:'医生',width:106,align:'center',
				formatter:docters
			},
			{field:'b',title:'护士',width:106,align:'center',
				formatter:zaobanhus},
			{field:'c',title:'医生',width:106,align:'center',
				formatter:zhongbanyis},
			{field:'d',title:'护士',width:106,align:'center',
				formatter:zhongbanhus},
			{field:'e',title:'医生',width:107,align:'center',
				formatter:wanbanyis},
			{field:'f',title:'护士',width:105,align:'center',
				formatter:wanbanhus},
			{field:'g',title:'医生',width:105,align:'center',
				formatter:yebanyis},
			{field:'h',title:'护士',width:107,align:'center',
				formatter:yebanhus}
	    ]]
	});
});
$(function(){
	//点击折叠面板中的功能按钮，创建一个新的tab
	$(".fun").click(function(){
		//获得按钮的内容
		var t = $(this).text();
		//获得按钮的自定义路径
		var h = $(this).attr("data-href");
		
		var funId = $(this).attr("data-id");
		//判断以该内容为标题的标签卡是否存在
		if($("#work").tabs("exists",t)){
			//打开对应的标签卡
			$("#work").tabs("select",t);
			return;
		}
		//不存在则新建一个标签卡
		$("#work").tabs("add",{
				title:t,//标题
				id:funId,
				href:h,//得到访问路径，访问页面内容
				closable:true,//是否可关闭
				selected:true//是否选中
		});
	});
	
	//当用户点击移除，关闭当前打开的选项卡
	$("#tab-remove").click(function(){
		//获取选中的标签页面板
		var tab = $("#work").tabs("getSelected");
		var index = $("#work").tabs("getTabIndex",tab);
		//如果是工作台就不关闭
		if(index==0){
			return;
		}
		
		$("#work").tabs("close",index);
	});
	
	//关闭所有
	$("#tab-clear").click(function(){
		var tabs = $("#work").tabs("tabs");
		for(var i=tabs.length-1;i>0;i--){
			$("#work").tabs("close",i);
		}
	});
	
	
});

//更换主题
function changeTheme(themeName) {
	var $easyuiTheme = $('#easyuiTheme');
	var url = $easyuiTheme.attr('href');
	var href = url.substring(0, url.indexOf('themes')) + 'themes/' + themeName + '/easyui.css';
	$easyuiTheme.attr('href', href);
	var $iframe = $('iframe');
	if ($iframe.length > 0) {
		for ( var i = 0; i < $iframe.length; i++) {
			var ifr = $iframe[i];
			$(ifr).contents().find('#easyuiTheme').attr('href', href);
		}
	}
	$.cookie('easyuiThemeName', themeName, {
		expires : 7
	});
};

</script>
<div class="easyui-layout" data-options="fit:true,border:false" style="user-select:none;">
    <div data-options="region:'north',border:false" style="height:100px;background-color:white;">
    	<div style="border:none;width:100px;height:100px;margin-left:10px;background:url(static/img/tb.jpg) center no-repeat;background-size: cover;width:100px;float:left;"></div> 
    	<div style="float:left;margin-left:10px;line-height:100px;font-size:32px;font-family:'幼圆'">平 安 医 院</div>
		<span style="display: inline-block;display: inline-block;float: right;font-size: 19px;width: 350px;margin-top: 49px;font-family: 幼圆;">
			当前登陆：${user.userName }
		</span>
		<div style="position: absolute;right: 14px;top:44px;">
			<div class="easyui-panel" style="font-weight: 900;border-radius: 5px;border: 1px solid #bbb;">
				<a href="javascript:void(0);" class="easyui-menubutton" data-options="menu:'#layout_north_pfMenu',iconCls:'icon-ok'">更换主题</a>
			</div>
		</div> 
		<div id="layout_north_pfMenu" style=" display: none;">
			<div onclick="changeTheme('default');">default</div>
			<div onclick="changeTheme('gray');">gray</div>
			<div onclick="changeTheme('ui-cupertino');">ui-cupertino</div>
			<div onclick="changeTheme('ui-dark-hive');">ui-dark-hive</div>
			<div onclick="changeTheme('ui-pepper-grinder');">ui-pepper-grinder</div>
		</div>
   		
    </div>  
    
    <div data-options="region:'west',title:'功能导航',split:true,collapsible:false" style="width:200px;">
    	<div id="aa" class="easyui-accordion" data-options="fit:true,border:false">

    	  <c:forEach items="${fts}" var="f1">
		    <h:fun funId="${f1.functionId}">
			    <div title="${f1.functionName}" data-options="iconCls:'${f1.functionIcon}'" style="overflow:auto;">
			    	<c:forEach items="${funs[f1.functionName]}" var="f2">
			    		<h:fun funId="${f2.functionId}">
			    			<a class="fun easyui-linkbutton" data-id="${f2.functionId}" data-href="${f2.functionUrl}" style="width:190px">${f2.functionName}</a>
			   			</h:fun>
			   		</c:forEach>
			    </div>
		    </h:fun>
		   </c:forEach>
		</div>
    </div>
	<div data-options="region:'center'" style="background:#eee;">
	   	<div id="work" class="easyui-tabs"  data-options="fit:true,border:false,tools:'#tab-tools,#tab-tool'">
		    <div title="工作台" >

					  <div id="body1">

								<div id="zuozhen" >平安医院今日坐诊医生</div>

								 	<div id="swxw">
								 		<div id="sjry">时间</div>
								 		<div id="zuo">上午--(08:00-12:00)</div>
								 		<div id="zuo1">下午--(14:00-17:00)</div>
								 		<div id="zuo2">晚上--(17:00-24:00)</div>
								 		<div id="zuo3">夜班--(24:00-08:00)</div>
								 	</div>  
									 <table id="panbbban" singleSelect="true" style="height:530px;width:952px;">
									 </table>		
				 </div>
			
 		 	</div>

    </div>
    
   <!-- 标签卡的工具栏 -->
    <div id="tab-tools" style="border-left:none;border-right:none;border-top:none">
    	<button id="logout" style="color: blueviolet;outline:none;margin-right: 10px;background: none;cursor: pointer;border: 1px solid #ccc;border-radius: 4px;">退出登录</button> 
		<a id="tab-remove" href="#" class="easyui-linkbutton" plain="true" iconCls="icon-remove"></a>
		<a id="tab-clear" href="#" class="easyui-linkbutton" plain="true" iconCls="icon-cancel"></a>
	</div>

<div id="qxa1" class="easyui-window" title="个人中心" style="width:360px;padding-top:15px;height:430px"
	    	data-options="modal:true,collapsible:false,minimizable:false,
				maximizable:false,closed:true,draggable:false,shadow:true,resizable:false">
		<form id="xgxxa">

		<p>
				<input id="yhid1" class="easyui-textbox" readonly="true" required="required"
					data-options="label:'编号：',width:250,labelAlign:'right'">
					</p>
		<p>
				<input id="yhname1" class="easyui-textbox" readonly="true" required="required"
				data-options="label:'姓名：',width:250,labelAlign:'right'">
		</p>
		<p>
				<input id="zt1" class="easyui-textbox" readonly="true" required="required"
					data-options="label:'状态：',width:250,labelAlign:'right'">
					</p>
		<p>
				<input id="phone1" class="easyui-textbox" readonly="true" required="required"
				data-options="label:'电话：',width:250,labelAlign:'right'">
				
		</p>
		<p>
				<input id="xzksa1" class="easyui-textbox" readonly="true" required="required"
					data-options="label:'科室：',width:250,labelAlign:'right'">
		</p>
		<p>
				<input id="pwd1"class="easyui-passwordbox" required="required"
									data-options="label:'原密码：',width:270,labelAlign:'right'">
		</p>
		<p>		
				<input id="pwds1" class="easyui-passwordbox"  required="required"
									data-options="label:'新密码：',width:270,labelAlign:'right'">
		</p>
		<p style="text-align: center;">
				<a class='easyui-linkbutton' id="xgxx1" style="padding:0 8px;">确 认</a>
 		</p>
		</form>
		
	</div>
</div>
</body>
</html>